import Vue from "vue";
import App from "./App.vue";
// 将三级联动组件、分页器注册为全局组件
import TypeNav from "./components/TypeNav";
import Pagination from "./components/Pagination";
import { MessageBox } from "element-ui";
// 第一个参数：全局组件名字，第二个参数：全局组件
Vue.component(TypeNav.name, TypeNav);
Vue.component(Pagination.name, Pagination);
// ElementUI注册组件
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

// 引入路由
import router from "./router";
// 引入vuex的store
import store from "./store";
// 引入mockServe.js ----mock数据
import "./mock/mockServe";
// 引入Swiper样式
import "swiper/css/swiper.css";
// 统一接口api文件夹里面全部请求函数
import * as API from "./api";

Vue.config.productionTip = false;

new Vue({
  render: (h) => h(App),
  beforeCreate() {
    Vue.prototype.$bus = this; // 配置全局事件总线
    Vue.prototype.$API = API;
  },
  store,
  router, // 注册路由
}).$mount("#app");
